from MyQR import myqr
import PIL.Image as Image
from PIL import ImageDraw,ImageFont
# 读取两个（有无字幕） 连接 生成二维码
with open('link') as f:
    lines = f.readlines()
    link_sub = lines[0][0:-1]
    link_no_sub = lines[1]

myqr.run(link_sub,version=10,save_name='have_sub.jpg')
myqr.run(link_no_sub,version=10,save_name='no_sub.jpg')

qr_left = Image.open('have_sub.jpg')
qr_right = Image.open('no_sub.jpg')

print(qr_left.size)
new_image = Image.new('RGB', (1370,750), color='white')
# 粘贴二维码
new_image.paste(qr_left,(50,50))
new_image.paste(qr_right,(585+150,50))

# 定义添加的文字字体
font = ImageFont.truetype('C:\Windows\Fonts\迷你简少儿.ttf',50)
# 带有两个二维码的图片变为可编辑模式
draw = ImageDraw.Draw(new_image)
draw.text((125,660),'视频片段（有字幕）',fill='black',font=font)
draw.text((125+585+100,660),'视频片段（无字幕）',fill='black',font=font)
new_image.save('finel_qr.jpg')